<?php
$invoice = Invoice::instance()->getOne($_GET['id']);
if(!$invoice){ 
	View::display('message', array('head'=> 'Invoice', 'message'=> "ไม่พบ invoice id {$_GET['id']}"));
	exit();
}
$invoice['package'] = Package::instance()->getOne($invoice['packageId']);
$invoice['account'] = Account::instance()->getOne($invoice['accountId']);
if($invoice['profileType']=='other'){
    $invoice['profile'] = Table::instanceTable('Profile')->getOne($invoice['profileId']);
}

$optional = array();
$account = Account::instance()->getOne($invoice['accountId']);
View::display('invoice', array('invoice'=> $invoice));